﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CGOnline.Server.Core;
using CGOnline.Server.Components;
using System.Runtime.Serialization;

namespace CGOnline.Server.UserLayer
{
    [DataContract(Namespace="CGOline.Server.UserLayer.UserBase")]
    [StateAnnouncement(StateGroup = USER_STATEGROUP, StateName = USER_STATEGROUP_ONLINE)]
    [StateAnnouncement(StateGroup = USER_STATEGROUP, StateName = USER_STATEGROUP_LEAVE)]
    [StateAnnouncement(StateGroup = USER_STATEGROUP, StateName = USER_STATEGROUP_OFFLINE)]
    public abstract class UserBase : StateObject
    {
        public const string USER_STATEGROUP = "UserState";
        public const string USER_STATEGROUP_ONLINE = "Online";
        public const string USER_STATEGROUP_LEAVE = "Leave";
        public const string USER_STATEGROUP_OFFLINE = "Offline";

        abstract public bool LeaveRoom();
        abstract public bool AttendRoom(RoomBase room, object data);
        abstract public bool SendMsg(Message msg);
        abstract public List<Message> ReceiveMsgs();
        public IUserChannel UserChannel {protected get; set; }

        [DataMember]
        public UserConfig Config { get; protected set; }
    }

    public enum UserEventType
    {
        RoomEvent,
        StateChange
    }

    public class UserEventArgs : MyEventArgs
    {
        public UserEventType EventType;
        public object EventData;
    }
}
